import zlib

file_name = 'DLG_Text'
m_iCryptoKey = 0xA2


def 解压(file_name):
    with open(f'output/提取自data.unity3d/{file_name}', "rb") as f:
        data = bytearray(f.read())

    for i in range(len(data)):
        v = i + m_iCryptoKey + 0x23D
        v *= m_iCryptoKey
        v ^= i % 7
        data[i] ^= v & 0xFF

    with open(f'output/解密后/{file_name}' + ".txt", "wb") as f:
        f.write(zlib.decompress(data))


if __name__ == '__main__':
    解压('DLG_Text')
    解压('DLG_Indx')
